"""
获取股吧网站中热门主题下所有的帖子
    分别获取
        阅读量 评论量 标题 作者 更新时间
"""
#导模块
import re

import requests
url = 'http://guba.eastmoney.com/default,99_1.html'
def set_req(url,**kwargs):
    #构造请求头
    headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
                          'AppleWebKit/537.36 (KHTML, like Gecko) '
                          'Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.43'}
#发送请求
    response=requests.post(url,params=kwargs,headers=headers)

    with open('guba.html','wb') as file_build:
        file_build.write(response.content)
def parse_data():
    with open('guba.html','r',encoding='utf8')as f:
        html=f.read()
        res=re.findall('<ul class="newlist" tracker-eventcode="gb_xgbsy_ lbqy_rmlbdj">(.*?)</ul>',html,re.S)
        print(res)
if __name__=='__main__':
    parse_data()